<template>
  <!-- 审核组件 -->
  <edu-dialog
    :title.sync="dialog.title"
    :visible.sync="dialog.showDialog"
    @close="close"
    width="400px"
  >
    <el-form
      ref="dialogForm"
      label-position="top"
      :model="dialog.formData"
      :rules="dialog.rules"
      label-width="230px"
      size="small"
    >
      <el-row>
        <el-col :span="24">
          <el-form-item label="审核意见" prop="content">
            <el-input
              v-model="dialog.formData.content"
              clearable
              type="textarea"
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <span slot="buttons">
      <el-button type="primary" @click="submit(1, '审核成功')">通过</el-button>
      <el-button type="danger" @click="submit(2, '已驳回')">驳回</el-button>
    </span>
  </edu-dialog>
</template>

<script>
import { resetPassword } from "@/api/users";
import utils from "@/utils";

export default {
  props: ["url"],
  data() {
    return {
      dialog: {
        title: "审核",
        showDialog: false,
        formData: {
          content: "",
          idList: [],
        },
        rules: {},
      },
    };
  },
  created() {},
  methods: {
    open(data) {
      this.dialog.formData = {};
      this.dialog.formData.idList = data;

      this.dialog.showDialog = true;
    },
    close() {
      this.dialog.formData = {};

      this.dialog.showDialog = false;
    },
    async submit(process, msg) {
      this.url({
        ...this.dialog.formData,
        process: process, // 审核操作，1：通过，2：驳回
      }).then((res) => {
        this.$message({
          type: "success",
          message: msg,
        });
        this.close(this.dialog);

        this.$emit("done");
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>
